package com.lmf.rabbitmq.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 备份交换机的警告队列的消费者
 */
@Component
@Slf4j
public class WarningConsumer {

    @RabbitListener(queues = "warning.queue")
    public void received(Message message){
        String msg = new String(message.getBody());
        log.warn("报警发现不可路由消息：{}", msg);
    }
}
